﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unis.Framework.ORM.BaseDefiniens.Enums;

namespace Unis.ORM
{
    public class OrmConnectionParams
    {
        /// <summary>
        /// 数据库地址
        /// </summary>
        public string Ip { get; private set; }
        /// <summary>
        /// 数据库用户名
        /// </summary>
        public string UserId { get; private set; }
        /// <summary>
        /// 数据库密码
        /// </summary>
        public string Password { get; private set; }
        /// <summary>
        /// 数据库名称
        /// </summary>
        public string DatabaseName { get; private set; }

        /// <summary>
        /// 数据库配置名称(connectionStrings/add)中的Name
        /// </summary>
        public string DataBaseConfigName { get; private set; }

        public DatabaseType DatabaseType { get; private set; }

        public OrmConnectionParams(string ip, string userId, string password, string databaseName)
        {
            Ip = ip;
            UserId = userId;
            Password = password;
            DatabaseName = databaseName;
        }

        public OrmConnectionParams(string dataBaseConfigName, DatabaseType databaseType = DatabaseType.MSSQLServer)
        {
            DataBaseConfigName = dataBaseConfigName;
            DatabaseType = databaseType;
        }
    }
}
